package app

import (
    "github.com/gin-gonic/gin"
    "net/http"
    "os"
)

type (
    SMap     = map[string]string      //字符串map
    GMap     = map[string]interface{} //对象map
    Callback func()                   //无参数回调函数
)

const (
    FileWritePerm os.FileMode = 0644 //默认文件写入权限
    Empty         string      = ""   //空字符串
)

// panic
func Panic(err error) {
    if err != nil {
        panic(err)
    }
}

func Json(c *gin.Context, r Rest) {
    c.JSON(http.StatusOK, r)
}

func MustShouldBindJSON(c *gin.Context, obj interface{}) {
    if err := c.ShouldBindJSON(obj); err != nil {
        Panic(err)
    }
}
